<?php
    //config themes     
    require_once(CAKE .'Model/ConnectionManager.php');
    $db = ConnectionManager::getDataSource('default');               
    $sub_site[0] = array(
        'sub_sites' => array(
            'id' => '1',
            'sub_site' => 'http://demo.amz.vn/',
            'theme_id' => '1',
            'description' => 'Trang chính',
            'subsite_name' => 'Trang chính',
            'phone' => null,
            'hotline' => null,
            'email' => null,
            'themes' => array(
                'id' => '1',
                'themes_name' => 'Technology',
                'description' => 'Layout chinh'
            )
        ));         
    $config['App']['themes']['installed'] = array(
        'Technology','Green');
    $config['App']['themes']['enabled'] = array(
        'Technology','Green');   
    Configure::write('App.themes.sub_sites',$sub_site);            
    $_CONFIGS_THEMES = array(1=>'Technology');
    Configure::write('App.themes.listTheme',$_CONFIGS_THEMES);      
    Configure::write('App.themes.listSubSite',Set::combine($sub_site,'{n}.sub_sites.id','{n}.sub_sites.subsite_name'));
    $front = "";             
    $config['App']['themes']['default'] = array(
        'front' =>'Technology',
        'back' => 'Green'
    );        
    $config['Authorize']['activated'] = true;
    $config['Authorize']['antidetect']['all']['activated'] = true;
    $config['Authorize']['antidetect'][0] = 'Basic';
    $config['Authorize']['authenticate']['all']['userModel'] = 'User.User';
    $config['Authorize']['authenticate']['all']['patterns']['email'] = '/\\w{1,}[@][\\w\\-]{1,}([.]([\\w\\-]{1,})){1,3}$/';
    $config['Authorize']['authenticate']['all']['scope']['enabled'] = true;
    $config['Authorize']['authenticate']['all']['contain'] = array('Role');
    $config['Cache']['check'] = true;
    $config['Cache']['clearnup'] = true;
    $config['Cache']['disable'] = false;
    $config['Cache']['duration'] = 2592000;
    $config['Cache']['maxsize'] = 200;
    $config['Datetime']['firstDayOfWeek'] = 1;
    $config['Datetime']['timeZone'] = 'Asia/Bangkok';
    $config['Datetime']['date']['short'] = 'Y-m-d';
    $config['Datetime']['date']['medium'] = 'D, m/d/Y';
    $config['Datetime']['date']['long'] = 'l, F j, Y';
    $config['Datetime']['time']['short'] = 'H:i';
    $config['Datetime']['time']['medium'] = 'H:i:s';
    $config['Datetime']['time']['long'] = 'H:i:s';
    $config['Information']['email'] = 'vantienvnn@gmail.com';
    $config['Information']['name'] = 'TVPANEL POWER';
    $config['Information']['sologan'] = '';
    $config['Information']['title'] = '';
    $config['Information']['keyword'] = '';
    $config['Information']['description'] = '';
    //Config Language
    $sql = "SELECT *";
    $sql .= " FROM config_language";
    $config_language = $db->query($sql);            
    if(empty($config_language)){
        echo "Lỗi: Bạn phải cấu hình ít nhất một ngôn ngữ cho hệ thống. Vui lòng xem lại !";die;
    }
    Configure::write('App.Languages.config_language',$config_language); 
    foreach($config_language as $k=>$v){
        if($v['config_language']['active']==1){
            $config['Routing']['language'] = $v['config_language']['language_code']; 
            Configure::write('App.Languages.languageCurrent',$v);            
        }                
        $config['Languages'][$v['config_language']['language_code']]['charset'] = 'utf-8';
        $config['Languages'][$v['config_language']['language_code']]['code'] = $v['config_language']['language_code'];
        $config['Languages'][$v['config_language']['language_code']]['locale'] = $v['config_language']['prefix'];
        $config['Languages'][$v['config_language']['language_code']]['direction'] = 'ltr';
        $config['Languages'][$v['config_language']['language_code']]['domain'] = $v['config_language']['language_code'].'.greencms.toancauxanh.vn';
        $config['Languages'][$v['config_language']['language_code']]['encodingLists'] = '';        
        $config['Languages'][$v['config_language']['language_code']]['name'] = $v['config_language']['name'];
        $config['Languages'][$v['config_language']['language_code']]['native'] = $v['config_language']['name'];
        $config['Languages'][$v['config_language']['language_code']]['prefix'] = $v['config_language']['prefix'];
        $config['Languages'][$v['config_language']['language_code']]['datetime'] = array();
        $config['Languages'][$v['config_language']['language_code']]['path'] = $v['config_language']['path'];        
    }        
    //End  
    
     //Configure Mail
    $config['Mail']['port'] = 465;
    $config['Mail']['timeout'] = 30;
    $config['Mail']['host'] = 'ssl://smtp.gmail.com';
    $config['Mail']['username'] = 'vantu06i@gmail.com';
    $config['Mail']['password'] = 'dungcomo';
    $config['Mail']['sendAs'] = 'html';
    $config['Mail']['prefix'] = '[AMZ]';
    $config['Mail']['delivery'] = 'smtp';
    $config['Mail']['from'] = '[ AMZ ] <info@amz.com>';    
    $config['Mail']['from'] = '[ AMZ ] <info@amz.com>';    
    Configure::write('App.Mail',$config['Mail']);
    //End
    
      
    $config['Logging']['enabled'] = true;
    $config['Logging']['limit'] = 10000;
    $config['Logging']['types']['warning'] = true;
    $config['Logging']['types']['notice'] = true;
    $config['Logging']['types']['error'] = true;
    $config['Logging']['types']['debug'] = true;
    $config['Logging']['types']['info'] = true;
    $config['Logging']['types']['event'] = true;
    $config['Logging']['types']['login'] = true;
    $config['Logging']['types']['created'] = true;
    $config['Logging']['types']['updated'] = true;
    $config['Logging']['types']['deleted'] = true;
    $config['Maintenance']['activated'] = false;
    $config['Maintenance']['message'] = 'Localhost is currently under maintenance. We should be back shortly. Thank you for your patience.';
    $config['Maintenance']['time'] = '2012-3-17 11:22';
    $config['Maintenance']['allowedActions'][0] = 'login';
    $config['Maintenance']['allowedActions'][1] = 'captcha';
    $config['Maintenance']['cacheCheck'] = false;
    $config['Modules']['System']['autoConfig'] = false;
    $config['Modules']['System']['description'] = '';
    $config['Modules']['System']['name'] = 'System';
    $config['Modules']['System']['routes'] = true;
    $config['Modules']['User']['autoConfig'] = false;
    $config['Modules']['User']['description'] = '';
    $config['Modules']['User']['name'] = 'User';
    $config['Modules']['User']['helpers'] = array('User.UserHook');
    $config['Modules']['User']['routes'] = true;
    $config['Modules']['Node']['autoConfig'] = false;
    $config['Modules']['Node']['description'] = '';
    $config['Modules']['Node']['name'] = 'Node';
    $config['Modules']['Node']['routes'] = true;  
    $config['Modules']['Regional']['autoConfig'] = false;
    $config['Modules']['Regional']['description'] = '';
    $config['Modules']['Regional']['name'] = 'Regional';
    $config['Modules']['Regional']['routes'] = true;
    $config['Modules']['Block']['autoConfig'] = false;
    $config['Modules']['Block']['description'] = '';
    $config['Modules']['Block']['name'] = 'Block';
    $config['Modules']['Block']['routes'] = true;
    $config['Modules']['Menu']['autoConfig'] = false;
    $config['Modules']['Menu']['description'] = '';
    $config['Modules']['Menu']['name'] = 'Menu';
    $config['Modules']['Menu']['routes'] = true;
       
        
    //View module 
    $config['Modules']['View']['autoConfig'] = false;
    $config['Modules']['View']['description'] = '';
    $config['Modules']['View']['name'] = 'View';
    $config['Modules']['View']['routes'] = true;
    $config['Modules']['View']['helpers'] = array('View.ViewHook');   

    //View module 
    $config['Modules']['Api']['autoConfig'] = false;
    $config['Modules']['Api']['description'] = '';
    $config['Modules']['Api']['name'] = 'Api';
    $config['Modules']['Api']['routes'] = true;    
        
    //$config['Modules']['System']['helpers'][0] = 'System.Validate';
    $config['Routing']['detection']['browser'] = false;
    $config['Routing']['detection']['session'] = false;
    $config['Routing']['detection']['parameter'] = 'language';
    $config['Routing']['detection']['enabled'] = true;
    $config['Routing']['detection']['redirect'] = true;
    $config['Routing']['detection']['isPrefix'] = true;
    $config['Routing']['extension'][0] = 'html';
    $config['Routing']['extension'][1] = 'xml';
    $config['Routing']['extension'][2] = 'rss';    
    $config['Routing']['prefixes'] = array('admin', 'manage');
   
    $config['Session']['defaults'] = 'php';
    $config['Session']['checkAgent'] = false; //test, set true if not test
    $config['Session']['cookie'] = 'TVPANEL';
    $config['Session']['timeout'] = 240;
    //$config['Session']['cookieTimeout'] = 0;
    $config['Modules']['DebugKit']['autoConfig'] = false;
    $config['Modules']['DebugKit']['description'] = '';
    $config['Modules']['DebugKit']['components'][0] = 'DebugKit.Toolbar';
    $config['Modules']['DebugKit']['name'] = 'Debug Kit'; 
    $config['debug'] = 2;
?>